#!/bin/bash -e

function info() {
echo Usage: `basename $0` 'path'
exit 1
}

while getopts  ":p:f:" opt; do
	case  $opt  in
		p) out_prefix=$OPTARG;;
		f) suffix=$OPTARG;;
		*) info;;
	esac
done
shift $(($OPTIND - 1))


if [ $# -lt 1 ]; then info; fi

. $var

target=$data/intervals/1/adm/target.1960.bed


path=$1
find $path -name '*.g.vcf' > $out_prefix.gvcf.list
gvcf_combine.sh -p$out_prefix $out_prefix.gvcf.list # list can not be name like *.g.vcf
gvcf_gt.sh -i$target -p$out_prefix $out_prefix.combine.g.vcf

filter_vcf_bed.sh -p$out_prefix.target1960 $out_prefix.gt.vcf $target
# combine_vcfs.sh -p$out_prefix $ref $out_prefix.target1960.filter.vcf

admix4.sh -p$out_prefix $out_prefix.target1960.filter.vcf
wc -l $out_prefix.bim
# extract_sample_plink.sh -p$out_prefix $out_prefix $out_prefix.list.samples

. $cmd_done
